using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Data.SqlClient;

/// <summary>
/// Summary description for UserDAO
/// </summary>
public class UserDAO:DBAccess
{
    string SQL_SELECT = "select * from [Users] where [userid]=@uid and [password]=@pass";
    string message;
    public string Message
    {
        get { return message; }
    }
	public UserDAO()
	{

    }
    #region methods
    public bool checkAccount(string username, string password)
    {
        try
        {
            SqlCommand command = new SqlCommand(SQL_SELECT, conn);
            command.Parameters.AddWithValue("@uid", username);
            command.Parameters.AddWithValue("@pass", password);
            if (Connect())
            {
                SqlDataReader dr = command.ExecuteReader();                
                if (dr.Read()) return true;                
            }

        }
        catch (SqlException ex) { message = ex.Message; }
        catch (Exception ex) { message = ex.Message; }
        return false;
    }
    #endregion
}
